<?php $_product = $this->getProduct();?>
<div class="p_images">
	<div class="big_images">
    	<a href="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" rel="shadowbox[Aston Martin];" title="<?php echo '&nbsp;' . $_product->getName();?>">
     		<img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(317,317); ?>"/>
        </a>
        <?php $is_new = true;?>
        <?php if($is_new):?>
        	<img src="<?php echo $this->getSkinUrl('images/flag_new_in.png');?>" class="new_in">
        <?php endif;?>
	</div>
	<div class="small_images">
    	<?php if (count($this->getGalleryImages()) > 0):$img_count=0; ?>
			<?php $index = 1;?>
     		<?php foreach ($this->getGalleryImages() as $_image): ?>
            <?php 
				if($index >= 4){
					$style = 'last_a';
					$index = 1;
				}else{
					$style = '';
					$index++;
				}				
			?>
           	<a class="<?php echo $style;?>" rel="shadowbox[Aston Martin];" href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile()); ?>">
				<img alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(78, 77); ?>"/>
			</a>
            <?php endforeach;?>
        <?php endif;?>    
		<div class="clearfloat"></div>
	</div>
</div>